package vn.kiemviec.app.viewadapter;

import java.util.ArrayList;

import vn.kiemviec.app.R;
import vn.kiemviec.app.data.IndustryEntry;
import vn.kiemviec.app.utils.ViewHelper;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

public class IndustryAdapter extends ArrayAdapter<IndustryEntry> {

	public IndustryAdapter(Context context,ArrayList<IndustryEntry> list ) {
		super(context, 0, list);
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		if(convertView == null){
		
			LayoutInflater inflater = LayoutInflater.from(getContext());
			View v = inflater.inflate(R.layout.item_industry, null);
			convertView = v;
		}
		
		IndustryEntry entry = getItem(position); 
		ViewHelper.setText(convertView, R.id.txvIndustry, entry.IndustryTitle);
		ViewHelper.setText(convertView, R.id.txvJobCount,"(" + entry.JobActiveCount + ")");
		
		return convertView;
	}

}
